package com.baselibrary.utils;

import android.graphics.Rect;
import android.view.View;

import androidx.recyclerview.widget.RecyclerView;

public class SpacesRightNoEndDec extends RecyclerView.ItemDecoration {
    private int space;
    private int count;

    public SpacesRightNoEndDec(int space, int count) {
        this.space = space;
        this.count = count;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        int position = parent.getChildAdapterPosition(view);
        if (position!=count-1) {
            outRect.right = space;
        }
    }
}